package labox.innovation.loginserver.socket.serverpackets;

/**
 * 绑定手机号请求处理
 * 
 * @author Frank
 * 
 */
public final class ResponseBindAccount extends LoginServerPacket {
	/**
	 * 绑定手机号结果代码<br>
	 * 0:绑定手机号成功<br>
	 * 1:用户不存在或密码错误<br>
	 * 2:电话号码错误<br>
	 * 3:此号码已绑定<br>
	 * 4:系统错误<br>
	 */
	public static final int RESPONSE_ALLOK = 0x00;

	public static final int RESPONSE_ACCOUNTORPASSWORD_ERROR = 0x01;
	
	public static final int RESPONSE_PHONE_ERROR = 0x02;

	public static final int RESPONSE_BINDED_ERROR = 0x03;
	
	public static final int RESPONSE_SYSTEM_ERROR = 0x04;

	private int _code;

	private String _phoneNo;

	public ResponseBindAccount(int code, String phoneNo) {
		_code = code;
		_phoneNo = phoneNo;
	}

	@Override
	protected void write() {
		writeByte(PTL_RESPONSEBINDPHONENO);
		writeByte(_code);
		if (_code == RESPONSE_ALLOK)
			writeString(_phoneNo);
	}
}
